cmake_minimum_required(VERSION 3.8)
project(cpp_basketball_kalman)

# 查找所有必要的依赖包
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
# ！！！查找Eigen3库，这对于您的代码至关重要
find_package(Eigen3 REQUIRED)

# 添加可执行文件
# 列出所有需要一起编译的.cpp源文件
add_executable(kf_interpolator_node
  src/kf_interpolator_node.cpp
  src/MyKalmanFilter.cpp
  src/KF.cpp
)

# 包含头文件目录，以便#include能找到它们
# ${EIGEN3_INCLUDE_DIR} 是find_package(Eigen3)后自动设置的变量
include_directories(
  include/cpp_basketball_kalman
  ${EIGEN3_INCLUDE_DIR}
)

# 链接库
# 将可执行文件链接到它所依赖的库
ament_target_dependencies(kf_interpolator_node
  "rclcpp"
  "geometry_msgs"
  "visualization_msgs"
  "Eigen3"
)

# 安装可执行文件
# 这会让ros2 run能够找到你的节点
install(TARGETS
  kf_interpolator_node
  DESTINATION lib/${PROJECT_NAME}
)

install(
  DIRECTORY include/
  DESTINATION include
)
# ament的收尾工作
ament_package()

